import request from '@/utils/request'

export function login(data,loginPhone) {
  alert(JSON.stringify(loginPhone)+"dddd")
  return request({
    url: '/tbUser/login',
    method: 'post',
    params: {
      username: data.username,
      password: data.password,
      code: data.code
    },
    data:loginPhone
  })
}
//拿登陆用户的信息
export function getInfo(token) {
  return request({
    url: '/tbUser/info',
    method: 'get',
    params: { token:token }
  })
}
//退出
export function logout() {
  return request({
    url: 'tbUser/loginOut',
    method: 'post'
  })
}
//查询数据
export function findByPageOrTbUserVo(current,size,data) {
  return request({
    url: `tbUser/findByPageOrTbUserVo/${current}/${size}`,
    method: 'post',
    data
  })
}

//查询部门对应的数量
export function findByDepartmentAndCount() {
  return request({
    url: 'tbDepartment/findByDepartmentAndCount',
    method: 'get'
  })
}

//删除操作请求
export function removeById(id) {
  return request({
    url: `tbUser/removeById/${id}`,
    method: 'delete'
  })
}

//新增操作请求
export function instUser(data) {
  return request({
    url: '/tbUser/instUser',
    method: 'post',
    data
  })
}

//修改操作
export function updUser(data) {
  return request({
    url:'/tbUser/updUser',
    method:'put',
    data
  })
}

//禁用操作
export function updStatusById(id,status) {
  return request({
    url:'/tbUser/updStatusById',
    method:'post',
    params:{
      id:id,
      status:status
    }
  })
}

//导出用户信息 没有用到
export function downloadUsershttp(data) {
  return request({
    url:'http://localhost:8001/tbUser/downloadExcel',
    method:'post',
    responseType:'blob',
    data
  })
}

//验证码发送
export function sendPhone(phone) {
  return request({
    url:`/tbUser/sendPhone/${phone}`,
    method:'Get'
  })
}

